// 操作下拉框
import { Button, Dropdown, Menu } from '@alifd/next';
import React from 'react';

export interface operationMenuProps {
  data: Array<{
    // 点击事件
    click: () => void;
    // 显示内容
    children: React.ReactNode;
  }>;
}

// 表格 下拉
const OperationMenu: React.FC<operationMenuProps> = ({ data }) => {
  return (
    <Dropdown trigger={<Button>操作</Button>}>
      <Menu>
        {data.map((item, index) => {
          return (
            <Menu.Item className="flex justify-center" onClick={item.click} key={index}>
              {item.children}
            </Menu.Item>
          );
        })}
      </Menu>
    </Dropdown>
  );
};
export default OperationMenu;
